package GUI.ManagerEmployee;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ManagerEmployeeGUI extends JFrame {

	private JPanel contentPane;
	ManagerEmployeeGUI frame ;
	//private DefaultPanel ourpanel;
	public GetSaleOperationPnl getSaleOperationPnl;
	JPanel centerPanel;
	ReportsPanel reportsPanel;
	public AddSaleTemplatePnl addSaleTemplatePnl; 
	public NewSalePnl newSalePnl;
	DefaultPanel defaultPanel;


	public ManagerEmployeeGUI() {
		
		//Initialize the panels.
		centerPanel = new JPanel();
		newSalePnl = new NewSalePnl();
		addSaleTemplatePnl = new AddSaleTemplatePnl();
		getSaleOperationPnl = new GetSaleOperationPnl();
		defaultPanel = new DefaultPanel();

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 816, 527);
		contentPane = new JPanel();
		
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		
		
		
		 

		
  // ------------------  Get Reports ----------------	
		
		JButton btnGetReport = new JButton("get report");
		btnGetReport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				reportsPanel = new ReportsPanel();
				 
				contentPane.remove(centerPanel);
				centerPanel = reportsPanel;
				centerPanel .setBounds(171, 11, 619, 451);
				contentPane.add(centerPanel );
				
                repaint();
                	
			}
		});
	
		btnGetReport.setBounds(10, 176, 151, 36);
		contentPane.add(btnGetReport);

		// ------------------  Define sale template  ----------------
		
		JButton btnSaleTemplate = new JButton("add sale template");
		btnSaleTemplate.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				 
				contentPane.remove(centerPanel);
				centerPanel = addSaleTemplatePnl;
				centerPanel .setBounds(171, 11, 619, 451);
				contentPane.add(centerPanel );
				
                repaint();
				
			}
		});
		btnSaleTemplate.setBounds(10, 78, 151, 36);
		contentPane.add(btnSaleTemplate);
		
		// ------------------  New sale ----------------		
		
		JButton btnNewSale = new JButton("new sale");
		btnNewSale.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				contentPane.remove(centerPanel);
				centerPanel = newSalePnl;
				centerPanel .setBounds(171, 11, 619, 451);
				contentPane.add(centerPanel );
                repaint();
			}
		});
		btnNewSale.setBounds(10, 125, 151, 36);
		contentPane.add(btnNewSale);
		
		// ------------------  Home ----------------	
		
		JButton btnHome = new JButton("home");
		btnHome.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				 
				contentPane.remove(centerPanel);
				centerPanel = defaultPanel;
				centerPanel .setBounds(171, 11, 619, 451);
				contentPane.add(centerPanel );
				
                repaint();
				
			}
		});
		btnHome.setBounds(10, 28, 151, 36);
		contentPane.add(btnHome);
		
		// ------------------  get sale operation ------------------
				JButton btngetSaleOperation = new JButton("get sale operation");
				btngetSaleOperation.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						
						 
						contentPane.remove(centerPanel);
						centerPanel = getSaleOperationPnl ;
						centerPanel .setBounds(171, 11, 619, 451);
						contentPane.add(centerPanel );
						
		                repaint();
					}
				});
				
				btngetSaleOperation.setBounds(10, 223, 151, 36);
				contentPane.add(btngetSaleOperation);
		
	//------------------------------------------------------------------	
		
		centerPanel.setBounds(171, 11, 619, 451);
		contentPane.add(centerPanel);
		
		
	//	JButton btnNewButton = new JButton("asas");

//		panel.add(btnNewButton);  //panel = the hole panel
	// ------------------  Exit ------------------		
		JButton btnExit = new JButton("exit");
		btnExit.setBounds(10, 383, 151, 36);
		contentPane.add(btnExit);
		
		JButton btnNewButton = new JButton("analytical system");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				contentPane.remove(centerPanel);
				centerPanel = addSaleTemplatePnl;
				centerPanel .setBounds(171, 11, 619, 451);
				contentPane.add(centerPanel );
				
                repaint();
			}
		});
		btnNewButton.setBounds(10, 270, 151, 36);
		contentPane.add(btnNewButton);
		
		setVisible(true);
	
	}
}
